//https://leetcode.cn/problems/wiggle-subsequence/

class Solution {
public:
    int wiggleMaxLength(vector<int>& nums) {
        int ret = 0, left = 0, right = 0;

        for (int i = 0; i < nums.size() - 1; i++)
        {
            right = nums[i + 1] - nums[i];
            if (right == 0) continue;
            if (left * right <= 0) ret++;
            left = right;
        }

        return ret + 1;

    }
};